import React, {Component} from 'react';
import {StyleSheet, ScrollView, RefreshControl, View} from 'react-native';
import PropTypes from 'prop-types';
import userStatus from "../../common/userStatus";
import Login from "./Login";
import {observer} from "mobx-react";
import Menu from "./Menu";
import {Provider} from "@ant-design/react-native";
import AdminMenu from "./AdminMenu";

@observer
export default class MineScreen extends Component {
    render() {
        const {navigation} = this.props

        return (
            <Provider>
                <ScrollView
                    style={styles.container}>
                    {
                        userStatus.userStatus.status === 'login' ?
                            (
                                userStatus.userStatus.type === 'User' ? (
                                    <Menu navigation={navigation} style={styles.order}/>
                                ) : (
                                    <AdminMenu navigation={navigation} style={styles.order}/>
                                )
                            ) : (
                                <Login navigation={navigation}/>
                            )
                    }
                </ScrollView>
            </Provider>
        )
    }
}
MineScreen.propTypes = {
    navigation: PropTypes.object.isRequired
};

const styles = StyleSheet.create({
    container: {
        flex: 1,
        flexDirection: 'column',
        backgroundColor: '#fff'
    },
    order: {
        marginTop: 10
    }
});
